package org.jwd.storage.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jwd.core.entity.AuthEntity;
import org.jwd.storage.dao.AuthMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author vizz
 * @since 2022/5/15 23:57
 */
@Service
public class AuthService extends ServiceImpl<AuthMapper, AuthEntity> {

    @Resource
    AuthMapper authMapper;

    public AuthEntity findLoginDisabled(Long userId) {
        return authMapper.findLoginDisabled(userId);
    }

    public AuthEntity findByValidation(String authorization) {
        return this.getOne(new QueryWrapper<AuthEntity>()
                .eq("validation", authorization)
                .ne("type",0));
    }
}
